package com.zyh.homeworkzhuantike;

import java.util.Scanner;

public class Test03 {
    public static void main(String[] args) {
//        创建Scanner输入金额
        Scanner input = new Scanner(System.in);
//        输出提示语并接收数据
        System.out.println("请输入存入的金额:");
        double money = input.nextDouble();
        if (money >= 1000) {
            //        输出提示并接收输入的存期
            System.out.println("请输入存期(1,2,3,5)");
            int year = input.nextInt();
            //        定义本息总额变量
            double sum;
//        计算本息总额:本息计算方式：本金+本金×年利率×年限
            //        定义年利率
            final double RATE1 = 0.0225;
            final double RATE2 = 0.027;
            final double RATE3 = 0.0325;
            final double RATE5 = 0.036;

            if (year == 1) {
                sum = money + money * RATE1 * 1;
                System.out.println("本息总额是：" + sum);
            }
            if (year == 2) {
                sum = money + money * RATE2 * 2;
                System.out.println("本息总额是：" + sum);
            }
            if (year == 3) {
                sum = money + money * RATE3 * 3;
                System.out.println("本息总额是：" + sum);
            }
            if (year == 5) {
                sum = money + money * RATE5 * 5;
                System.out.println("本息总额是：" + sum);
            }
        }
        else {
            System.out.println("1000起存!");
        }
    }
}
